
class Complex {
public int a;
public int b;

public Complex() {
        this(0, 0);
        }

public Complex(int a, int b) {
        this.a = a;
        this.b = b;
        }

public Complex min(Complex x1, Complex x2) {
        Complex x = new Complex();
        x.a = x1.a - x2.a;
        x.b = x1.b - x2.b;
        return x;
        }
public Complex add (Complex x1, Complex x2) {
        Complex x = new Complex();
        x.a = x1.a + x2.a;
        x.b = x1.b + x2.b;
        return x;
        }
public Complex mul (Complex x1, Complex x2){
    Complex x=new Complex();
    x.a=x1.a*x2.a+x1.b*x2.b*(-1);
    x.b=x1.a*x2.b+x1.b*x2.a;
    return x;
    }
}


public class Main {
    public static void main(String[] args) {
        Complex x1 = new Complex(2, 3);
        Complex x2 = new Complex(1, 2);
        Complex add = new Complex();
        Complex min = new Complex();
        Complex mul = new Complex();
        add = add.add(x1,x2);
        min = min.min(x1,x2);
        mul = mul.mul(x1,x2);
        System.out.println("加法结果:"+add.a+"+"+add.b+"i");
        System.out.println("减法法结果:"+min.a+"+"+min.b+"i");
        System.out.println("乘法结果:"+mul.a+"+"+mul.b+"i");
    }
}


